******************************************
******Replication Code for “Do Preliminary References Increase Public Support for European Law? Experimental Evidence from Germany"
******************************************

****Import dataset: Cheruvu_Krehbiel_IO_Replication_Data.csv
 
 
*********************
****Main Analyses****
*********************


****Creating education control variable****

replace voceduc_neu=. if voceduc_neu>100
gen education1 =.
replace education1=0 if voceduc_neu !=5
replace education1=1 if voceduc_neu==5


****Cleaning preference for democracy variable****

replace dempreferable_w6=1.5 if dempreferable_w6==3


****Creating trust differential variable****
replace confi_euj_w6=2 if confi_euj_w6==4
replace confi_bundesverfassungsgericht_w=2 if confi_bundesverfassungsgericht_w==4
gen ecj_trust_flip=4-confi_euj_w6
gen fcc_trust_flip=4-confi_bundesverfassungsgericht_w
gen ecj_fcc_trust_diff=ecj_trust_flip-fcc_trust_flip

gen trust_diff_dich=.
replace trust_diff_dich=0 if ecj_fcc_trust_diff>-1
replace trust_diff_dich=1 if ecj_fcc_trust_diff<0


****Creating DV****
gen eu_experiment_w6_flip=4-eu_experiment_w6
gen eu_accept_w6_flip=4-eu_accept_w6
replace eu_implement_w6=eu_implement_w6-1


alpha eu_experiment_w6_flip eu_accept_w6_flip eu_implement_w6
factor eu_experiment_w6_flip eu_accept_w6_flip eu_implement_w6, factors(1)
predict eu_experiment_support
sum eu_experiment_support
gen eu_experiment_support_dv = (eu_experiment_support - `r(min)') / (`r(max)'-`r(min)')


****Table A2 (Main Results)****
****Model 1****
reg eu_experiment_support_dv i.treat_2_w6 

****Data for Left Panel of Figure 1****
margins treat_2_w6, level(95)

****Reproduction of Left Panel of Figure 1 (Figure in manuscript created in R)****
marginsplot

****Model 2****
reg eu_experiment_support_dv i.i.treat_2_w6##i.trust_diff_dich

****Data for Right Panel of Figure 1****
margins trust_diff_dich, at(treat_2_w6=(1 (1) 2)) level(95)

****Reproduction of Right Panel of Figure 1 (Figure in manuscript created in R)****
marginsplot

****Model 3****
reg eu_experiment_support_dv i.treat_2_w6##i.trust_diff_dich unvaccinated_restrictions_w6_8 eu_integration_w6  i.most_liked_party_w6  dempreferable_w6 ecj_aware_w6 fcc_aware_w6  campaign_follow_w6 gender birthyear education1 ddr_1 i.urban_rural_1 i.sta


************************
****Balance Analyses****
************************

****Table A3 chi^2 Tests****

tab treat_2_w6 govt_partisan, chi2
tab treat_2_w6 unvaccinated_restrictions_w6_8, chi2
tab treat_2_w6 trust_diff_dich, chi2
tab treat_2_w6 eu_integration_w6, chi2
tab treat_2_w6 most_liked_party_w6, chi2


*****************************
****				     ****
**** Robustness Analyses ****
****				     ****
*****************************

***********************************************
****Table A4, Analyses Using Alernative DVs****
***********************************************

****DV: Agree with Decision****
reg eu_experiment_w6_flip i.treat_2_w6 
reg eu_experiment_w6_flip i.i.treat_2_w6##c.trust_diff_dich
reg eu_experiment_w6_flip i.treat_2_w6##c.trust_diff_dich unvaccinated_restrictions_w6_8 eu_integration_w6  i.most_liked_party_w6  dempreferable_w6 ecj_aware_w6 fcc_aware_w6  campaign_follow_w6 gender birthyear education1 ddr_1 i.urban_rural_1 i.sta

****DV: Accept Decision****
reg eu_accept_w6_flip i.treat_2_w6 
reg eu_accept_w6_flip i.i.treat_2_w6##c.trust_diff_dich
reg eu_accept_w6_flip i.treat_2_w6##c.trust_diff_dich unvaccinated_restrictions_w6_8 eu_integration_w6  i.most_liked_party_w6  dempreferable_w6 ecj_aware_w6 fcc_aware_w6  campaign_follow_w6 gender birthyear education1 ddr_1 i.urban_rural_1 i.sta

****DV: Oppose Noncompliance****
reg eu_implement_w6 i.treat_2_w6 
reg eu_implement_w6 i.i.treat_2_w6##c.trust_diff_dich
reg eu_implement_w6 i.treat_2_w6##c.trust_diff_dich unvaccinated_restrictions_w6_8 eu_integration_w6  i.most_liked_party_w6  dempreferable_w6 ecj_aware_w6 fcc_aware_w6  campaign_follow_w6 gender birthyear education1 ddr_1 i.urban_rural_1 i.sta


****Table A5, Analyses Using Alternative Measures of Trust in German Constitutional Court vs CJEU****

****Preparing "Court with Final Say on EU Law" variable****
gen ecj_fcc_disagree_w61=.
replace ecj_fcc_disagree_w61=1 if ecj_fcc_disagree_w6==1
replace ecj_fcc_disagree_w61=0 if ecj_fcc_disagree_w6==2
replace ecj_fcc_disagree_w61=0.5 if ecj_fcc_disagree_w6==3

****Preparing "Job Performance Difference" variable****
replace ecj_job_w6=5-ecj_job_w6
replace fcc_job_w6=5-fcc_job_w6
gen ecj_fcc_job_diff=ecj_job_w6-fcc_job_w6


****Variable: Confidence Difference****
reg eu_experiment_support_dv i.i.treat_2_w6##c.ecj_fcc_trust_diff
reg eu_experiment_support_dv i.treat_2_w6##c.ecj_fcc_trust_diff unvaccinated_restrictions_w6_8 eu_integration_w6  i.most_liked_party_w6  dempreferable_w6 ecj_aware_w6 fcc_aware_w6  campaign_follow_w6 gender birthyear education1 ddr_1 i.urban_rural_1 i.sta

****Variable: Job Performance Difference****
reg eu_experiment_support_dv i.i.treat_2_w6##c.ecj_fcc_job_diff
reg eu_experiment_support_dv i.treat_2_w6##c.ecj_fcc_job_diff unvaccinated_restrictions_w6_8 eu_integration_w6  i.most_liked_party_w6  dempreferable_w6 ecj_aware_w6 fcc_aware_w6  campaign_follow_w6 gender birthyear education1 ddr_1 i.urban_rural_1 i.sta

****Variable: Court with Final Say on EU Law****
reg eu_experiment_support_dv i.i.treat_2_w6##c.ecj_fcc_disagree_w61
reg eu_experiment_support_dv i.treat_2_w6##c.ecj_fcc_disagree_w61 unvaccinated_restrictions_w6_8 eu_integration_w6  i.most_liked_party_w6  dempreferable_w6 ecj_aware_w6 fcc_aware_w6  campaign_follow_w6 gender birthyear education1 ddr_1 i.urban_rural_1 i.sta


********************************
****				     	****
**** Preregistered Analyses ****
****				     	****
********************************

****Table A6, Preliminary References, Support for EU Integration and Support for EU Law****

****Model 1****
reg eu_experiment_support_dv i.i.treat_2_w6##c.eu_integration_w6 

****Data for Figure A3****
margins, dydx(treat_2_w6) at(eu_integration_w6=(1 (1) 3)) level(95)

****Reproduction of Figure A3 (Figure in manuscript created in R)****
marginsplot

****Model 2****
reg eu_experiment_support_dv i.i.treat_2_w6##c.eu_integration_w6 unvaccinated_restrictions_w6_8  i.most_liked_party_w6  dempreferable_w6 ecj_aware_w6 fcc_aware_w6  campaign_follow_w6 gender birthyear education1 ddr_1 i.urban_rural_1 i.sta

*********************************
*********************************
****				     	 ****
**** Additional Experimental ****
****		Evidence     	 ****
****				     	 ****
*********************************
*********************************

****IMPORTANT: The analyses in Appendix I ("Additional Experimental Evidence") use a different dataset (see below)****

****Import dataset: second_experiment_data.csv
 
 
****Note: The trust differential variable is already included in the dataset, but the code below shows how it is constructed. If you run the entire Do file it will give an error, so I am commenting it out.****

*replace confi_euj_w3=2 if confi_euj_w3==4
*replace confi_gerichte_w3=2 if confi_gerichte_w3==4
*gen gerichte_trust_flip=4-confi_gerichte_w3
*gen ecj_trust_flip=4-confi_euj_w3
*gen ecj_gerichte_trust_diff=ecj_trust_flip-gerichte_trust_flip


*gen trust_diff=.
*replace trust_diff=1 if ecj_gerichte_trust_diff<0
*replace trust_diff=0 if ecj_gerichte_trust_diff>-1


****The below code constructs the DV. It is included to show how we constructed the variable. Since this variable is already in the dataset running the code will give an error, so I am commenting it out.****

*gen eu_experiment_w3_flip=5-eu_experiment_w3
*gen eu_accept_w3_flip=5-eu_accept_w3

*alpha eu_experiment_w3_flip eu_accept_w3_flip eu_implement_w3
*factor eu_experiment_w3_flip eu_accept_w3_flip eu_implement_w3, factors(1)
*predict eu_experiment_dv
*sum eu_experiment_dv
*gen eu_experiment_support_dv = (eu_experiment_dv - `r(min)') / (`r(max)'-`r(min)')


****Table A7, Model 1****
reg eu_experiment_support_dv i.treat_3_w3


****Table A7, Model 2****
reg eu_experiment_support_dv i.treat_3_w3##i.trust_diff

****Data for Figure A4****
margins, dydx(treat_3_w3) at(trust_diff=(0(1)1)) level(95)

****Reproduction of Figure A4 (Figure in manuscript created in R)****
marginsplot

****Tabl A8, Model 1****
reg eu_experiment_support_dv i.treat_3_w3 if trust_diff==1


